﻿using System.Net.Http.Headers;
using AntDesign.Charts;

namespace SE.PO.CInterface.Web.Utils;

public class CInterfaceApiService
{
    public swaggerClient Client;

    public CInterfaceApiService(IHttpClientFactory clientFactory)
    {
        Client = new swaggerClient("https://localhost:18106/", clientFactory.CreateClient());
    }

    public async Task<AreaDto[]> GetPageAreas()
    {
        var client = new HttpClient();
        var request = new HttpRequestMessage
        {
            Method = HttpMethod.Put,
            RequestUri = new Uri("http://api/app/area/{id}"),
            Content = new StringContent("{}")
            {
                Headers =
                {
                    ContentType = new MediaTypeHeaderValue("application/json")
                }
            }
        };
        using var response = await client.SendAsync(request);
        response.EnsureSuccessStatusCode();
        var body = await response.Content.ReadAsStringAsync();
        Console.WriteLine(body);
    }
    
    
}